////////////////////////////////////////////////////////////////////////////////
//
//  This program is free software; you can redistribute it and/or modify 
//  it under the terms of the GNU Lesser General Public License as published 
//  by the Free Software Foundation; either version 3 of the License, or (at 
//  your option) any later version.
//
//  This program is distributed in the hope that it will be useful, but 
//  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
//  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
//  License for more details.
//
//  You should have received a copy of the GNU Lesser General Public License 
//  along with this program; if not, see <http://www.gnu.org/copyleft/lesser.html>.
//
////////////////////////////////////////////////////////////////////////////////

package merapi.gps.handlers
{

import merapi.gps.messages.GPSMessage;
import merapi.gps.model.GPSInfo;
import merapi.handlers.mxml.MessageHandler;
import merapi.messages.IMessage;	

//--------------------------------------
//  Events
//--------------------------------------

/**
 *  The gpsData ResultEvent
 *
 *  @type mx.rpc.events.ResultEvent.RESULT
 */
[Event(name="gpsData", type="mx.rpc.events.ResultEvent")]	


/**
 *  Handles Messages types of the GPSMessage types
 *  
 *  @author Adam Flater - adamflater.net
 */
public class GPSMessageHandler extends MessageHandler 
{
	//--------------------------------------------------------------------------
	//
	//  Constructor
	//
	//--------------------------------------------------------------------------
	
	/**
	 *  The default constructor
	 */
	public function GPSMessageHandler()
	{
		super();
		
		type = GPSMessage.GPS_DATA;
	}

	[Bindable] public var gpsInfo : GPSInfo = null;

	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
	
	/**
	 *  Handles the registered messages
	 */
	override public function handleMessage( message : IMessage ) : void
	{
		super.handleMessage( message );
		
		if ( message.type == GPSMessage.GPS_DATA )
		{
			gpsInfo = ( message as GPSMessage ).gpsInfo;
		}
	}

} //  end class
} //  end package